<?



?>




<!-- Third party script for BrowserPlus runtime (Google Gears included in Gears runtime now) -->
<script type="text/javascript" src="http://bp.yahooapis.com/2.4.21/browserplus-min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>

<!-- Load plupload and all it's runtimes and finally the jQuery queue widget -->
<script type="text/javascript" src="./public/js/plupload.full.js"></script>

<script type="text/javascript">
// Custom example logic
$(function() {
	var uploader = new plupload.Uploader({
		runtimes : 'gears,html5,flash,silverlight,browserplus',
		browse_button : 'pickfiles_<? echo  $tmpKey ?>',
		container : 'container_<? echo  $tmpKey ?>',
		max_file_size : '10mb',
		url : 'upload3.php?tmpPath=<? echo  $tmpPath ?>',
		flash_swf_url : '/plupload/js/plupload.flash.swf',
		silverlight_xap_url : '/plupload/js/plupload.silverlight.xap',
		filters : [
			{title : "Image files", extensions : "jpg,gif,png"},
			{title : "Zip files", extensions : "zip"}
		],
		resize : {width : 320, height : 240, quality : 90}
	});

	uploader.bind('Init', function(up, params) {
		//$('#filelist_<? echo  $tmpKey ?>').html("<div>Current runtime: " + params.runtime + "</div>");
		//up.start();
	});

	$('#uploadfiles_<? echo  $tmpKey ?>').click(function(e) {
		uploader.start();
		e.preventDefault();
	});

	uploader.init();

	uploader.bind('FilesAdded', function(up, files) {
		$.each(files, function(i, file) {
		
			$('#filelist_<? echo  $tmpKey ?>').append(
				
			
			);
			up.start();
			
			//document.getElementById( 'uploadfiles_<? echo  $tmpKey ?>').clic
			//$('form')[0].submit();
		});

		up.refresh(); // Reposition Flash/Silverlight
	});

	uploader.bind('UploadProgress', function(up, file) {
		//$('#' + file.id + " b").html(file.percent + "%");
	});

	uploader.bind('Error', function(up, err) {
		$('#filelist_<? echo  $tmpKey ?>').append(
		
		);

		up.refresh(); // Reposition Flash/Silverlight
	});

	uploader.bind('FileUploaded', function(up, file) {
		//$('#' + file.id + " b").html("100%");
		
		$('#filelist_<? echo  $tmpKey ?>').append( '<img id=' + file.id + ' src="<? echo APPPATH . "../public/images/".$this->session->userdata('filePath' ).$tmpPath  ?>' +	file.name + '" />' );
		
		mySrc = '<? echo APPPATH . "../public/images/".$this->session->userdata('filePath' ).$tmpPath."ORIG/" ?>' + file.name;
		<? echo $callBack ?>( mySrc );
		
		
		
	});
	uploader.bind('StateChanged', function(uploader) {
    {
          
        
        }
    });

});
</script>
<div id="container_<? echo  $tmpKey ?>">
	<div id="filelist_<? echo  $tmpKey ?>"></div>
	<br />
	<a id="pickfiles_<? echo  $tmpKey ?>" href="#"><img title="upload a new file" src=images/www/UL_file.jpg height=50 /></a>
	<a id="uploadfiles_<? echo  $tmpKey ?>" href="#"></a>
</div>
			